Extended map to support geo location entities#2337
Conversation
|
Hold on, I just realised that |
|
We have a map card. Why would you not at least add this source to the existing rather than copy all its code to a new file to add it? |
|
Sure, happy to do that as well. I'm just wondering how to untangle which config parameters are then required and which ones are optional: The default map requires How about: If |
…on entities vs defined entities
|
Alright, I merged the geo location code into the existing map. Sorry, accidentally closed the PR, reopened straight away... |
|
Geo location sources should probably be an array? |
Good point, because that would be the only way to join entities from different geo location platforms into one map. |
| const mapItems = (this._mapItems = []); | ||
|
|
||
| this._configEntities.forEach((entity) => { | ||
| var allEntities = []; |
There was a problem hiding this comment.
OK, will replace with let
| } | ||
|
|
||
| this._configEntities = processConfigEntities(config.entities); | ||
| this._configGeoLocationSources = config.geo_location_sources; |
There was a problem hiding this comment.
Don't assign before raising errors
There was a problem hiding this comment.
OK, moving code around.
|
Do you want to submit a PR to add this functionality to a map demo ? |
Sure. I'll take a look at that now... |
|
Just a note @exxamalte, |
|
@exxamalte I cannot find any documentation for this. Do you have something prepared, or should I add it when I'm documenting #2489 ? |
|
@thomasloven The documentation for this PR can be found here: home-assistant/home-assistant.io#7880 |
This is an extension to the lovelace map card that can not only display manually configured entities, but allows for configuring a
geo_location_sourcesarray; each geo location platform defines its source. All current geo location entities with that source will be displayed on the map automatically.Either
entitiesorgeo_location_sourcesis required; ifgeo_location_sourcesis defined, thenentitiesis optional.Sample card configuration:
Pull request in home-assistant.io: home-assistant/home-assistant.io#7880